convert_to_currency
This function is contained within finance.bgt in the BGT include directory, and is used to convert a number into a valid currency formatted string.
string convert_to_currency(int number, string currency_symbol)
Parameters:
number
The number that will be converted.
currency_symbol
Your local currency symbol, for example £, $, ¥, € etc.
Return value:
A string containing the converted currency.
Remarks:
The number parameter should contain the value in the smallest possible units. For example, if you are working in British Pounds then you will be providing the value in pence, in dollars the value will be in cents, etc. The function will then convert it into pounds and pence, dollars and cents, etc.
This function only works with positive numbers. Any value below 0 will return an empty string.
Example:
//Display a number as a currency.
#include "finance.bgt"
void main()
{
alert("convert_to_currency test", convert_to_currency(150, "£")); //output should be £1.50.
}